﻿// <copyright file="Activity.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-05-07</date>
// <summary>Activity class definition</summary>

namespace NYTimes.Data
{
    using System;
    using System.ComponentModel;
    using System.Windows.Media.Imaging;
    using Synergist;

    /// <summary>
    /// TimesPeople Activity
    /// </summary>
    public class Activity
    {
        #region Properties
        /// <summary>
        /// Gets or sets the Activity I
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// Gets or sets the User Display Nmae
        /// </summary>
        public string UserDisplayName { get; set; }

        /// <summary>
        /// Gets or sets the user Id
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// Gets or sets the URL to the User Picture (64x64 pixel image)
        /// </summary>
        public Uri UserPictureUrl { get; set; }

        /// <summary>
        /// Gets the User Picture (64x64 pixel image)
        /// </summary>
        public BitmapImage UserPicture
        {
            get
            {
                if (this.UserPictureUrl == null)
                {
                    return null;
                }

                var image = new BitmapImage(this.UserPictureUrl);

                return image;
            }
        }

        /// <summary>
        /// Gets or sets the activity verb
        /// </summary>
        public string Verb { get; set; }

        /// <summary>
        /// Gets or sets the activity object name
        /// </summary>
        public string Object { get; set; }

        /// <summary>
        /// Gets or sets the activiyt object description
        /// </summary>
        public string ObjectDescription { get; set; }

        /// <summary>
        /// Gets or sets the activity object URL
        /// </summary>
        public Uri ObjectUrl { get; set; }

        /// <summary>
        /// Gets or sets the Activity object type
        /// </summary>
        public string ObjectType { get; set; }

        /// <summary>
        /// Gets or sets the Activity object thumbnail URI
        /// </summary>
        public Uri ObjectThumbnailUrl { get; set; }

        /// <summary>
        /// Gets the activty object thumbnail image (75x75 pixel image)
        /// </summary>
        public BitmapImage ObjectThumbnail 
        { 
            get
            {
                if (this.ObjectThumbnailUrl == null)
                {
                    return null;
                }

                return new BitmapImage(this.ObjectThumbnailUrl);
            }
        }

        /// <summary>
        /// Gets or sets the date updated
        /// </summary>
        public DateTime DateUpdated { get; set; }

        /// <summary>
        /// Gets or sets the object note.  For recommendations, object_note is 
        /// a note added by the user in TimesPeople. For posts to Twitter, the 
        /// object_note is the text of the Tweet.
        /// </summary>
        public string ObjectNote { get; set; }

        #endregion

        /// <summary>
        /// returns a string with all of the non-null properties and values
        /// </summary>
        /// <returns>a string with all of the non-null properties and values</returns>
        public override string ToString()
        {
            return Synergist.Utility.GetProperties(this);
        }
    }
}
